package com.gl.saasservice.house.repository;

import com.gl.saasservice.house.entity.Community;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface CommunityRepository extends PagingAndSortingRepository<Community, String>, JpaSpecificationExecutor<Community>, JpaRepository<Community, String> {
    List<Community> findByCommunityIdIn(List<Long> communityIds);

    List<Community> findByCommunityIdInOrOrgId(List<Long> communityIds, Long orgId);

    List<Community> findByProvinceIdAndStatus(Long provinceId, Integer status);

    List<Community> findByCityIdAndStatus(Long cityId, Integer status);

    List<Community> findByDistrictIdAndStatus(Long districtId, Integer status);

    List<Community> findByStreetIdAndStatus(Long streetId, Integer status);

    List<Community> findByCommunityIdAndStatus(Long communityId, Integer status);

    List<Community> findByIdIn(List<String> ids);

    List<Community> findByIdInAndStatus(List<String> ids, Integer status);
    Community findByIdAndStatus(String id, Integer status);

    List<Community> findByOrgIdAndStatus(Long orgId, Integer status);

    List<Community> findByNameAndDistrictId(String name, Long districtId);

    List<Community> findByStatus(Integer status);

}
